<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 健康小屋控制器
 */
class HealthCommission extends AdminBase
{
    
    /**
     * 健康小屋列表，卫计委层面，显示自己管辖范围内的小屋列表
     */
    public function healthroomList()
    {

        $this->assign('list', $this->logicHealthroom->getHealthroomListForCommission());
        $dlist=parse_config_array('disease_type');
        $this->assign('disease_list',$dlist);
        return $this->fetch('healthroom_list');
    }
    

    
    /**
     * 健康小屋编辑
     */
    public function healthroomEdit()
    {
        IS_POST && $this->jump($this->logicHealthroom->healthroomEdit($this->param));
        
        $dlist=parse_config_array('disease_type');
        $this->assign('disease_list',$dlist);

        $this->assign('hospital_list',$this->logicDepartment->getDepartmentList(['type'=>1],true,'',200));
        $info = $this->logicHealthroom->getHealthroomInfo(['id' => $this->param['id']]);
        $this->assign('info', $info);
        
        return $this->fetch('healthroom_edit');
    }
    
    /**
     * 健康小屋删除
     */
    public function healthroomDel($id = 0)
    {
        
        $this->jump($this->logicHealthroom->healthroomDel(['id' => $id]));
    }

        /**
     * 医院列表
     */
    public function hospitalList()
    {


        $this->assign('list', $this->logicDepartment->getDepartmentList(['type'=>1]));
        
        return $this->fetch('hospital_list');
    }

        /**
     * 医院添加
     */
    public function hospitalAdd()
    {
        
        IS_POST && $this->jump($this->logicDepartment->departmentEdit($this->param,url('hospitalList')));

        $alist=parse_config_array('hospital_level');
        $this->assign('level_list',$alist);

        return $this->fetch('hospital_edit');
    }
    
        /**
     * 医院编辑
     */
    public function hospitalEdit()
    {
    
        IS_POST && $this->jump($this->logicDepartment->departmentEdit($this->param,url('hospitalList')));
        $alist=parse_config_array('hospital_level');
        $this->assign('level_list',$alist);
        
        $info = $this->logicDepartment->getDepartmentInfo(['id' => $this->param['id']]);
        $this->assign('info', $info);
        return $this->fetch('hospital_edit');
    }
    
    /**
     * 医院删除
     */
    public function hospitalDel($id = 0)
    {
        
        $this->jump($this->logicDepartment->departmentDel(['id' => $id]));
    }
   /**
     * 基层卫生医疗机构列表，卫计委层面
     */
    public function healthcenterList()
    {
        $this->assign('list', $this->logicDepartment->getDepartmentList(['type'=>['in',[4,5]]]));

        return $this->fetch('healthcenter_list');
    }
    
    /**
     * 健康小屋编辑
     */
    public function healthcenterEdit()
    {
        
        IS_POST && $this->jump($this->logicDepartment->departmentEdit($this->param,url('healthcenterList')));
        
        $dlist=parse_config_array('disease_type');
        $this->assign('disease_list',$dlist);
        $info = $this->logicDepartment->getDepartmentInfo(['id' => $this->param['id']]);
        $this->assign('info', $info);
        
        return $this->fetch('healthcenter_edit');
    }



    /**
     * 意见建议列表
     */
    public function healthroomSuggestionList()
    {
        $tlist=parse_config_array('activity_type');
        $this->assign('activity_type',$tlist);
        $list=$this->logicActivityDetail->getHealthroomSuggestionList();
        $this->assign('list',$list);
        return $this->fetch('healthroom_suggestion_list');
    }

            /**
     * 健康小屋基础数据导入
     */
    public function healthroomImport() { 

       $this->jump($this->logicHealthroom->healthroomImport());
    }

     /**
     * 【医院】基础数据导入
     */
    public function hospitalImport() { 
       $this->jump($this->logicDepartment->hospitalImport());
    }
     /**
     * 【基层卫生医疗机构】基础数据导入
     */
    public function healthcenterImport() { 
       $this->jump($this->logicDepartment->healthcenterImport());
    }
    /**
     * 服务评价列表，首先将活动明细信息汇总到活动表中，然后对小屋的每一次活动情况进行汇总。
     */
    public function healthroomEvaluationList()
    {

        $list=$this->logicActivity->getHealthroomEvaluationListForCommission();
        $this->assign('list',$list);
        return $this->fetch('healthroom_evaluation_list');
    }
}
